﻿using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using CppWinRTComponentDll;
using Windows.ApplicationModel.Core;
using Windows.Storage.Streams;
using Windows.UI.Xaml.Media.Imaging;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace Application1
{

    public sealed partial class BlankPage : Page
    {
        public D2DWraper d2dManager;
        public BlankPage()
        {
            this.InitializeComponent();
            d2dManager=new D2DWraper();

            //init d2d dwrite
            d2dManager.Initialize(CoreApplication.MainView.CoreWindow);

            //some simple function, just ignore
            txtAdd.Text = d2dManager.Add(10, 20).ToString();
            txtMul.Text = d2dManager.Mul(10, 20).ToString();
            txtSub.Text = d2dManager.Sub(20, 10).ToString();
        }


        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //draw 
            InMemoryRandomAccessStream sssss = d2dManager.DrawTextToImage(txtSub.Text + "- Metro QQ Group 95331609", "Q.png", "Q_OUT.png");
            BitmapImage bmp = new BitmapImage();
            bmp.SetSource(sssss);
            loImage.Source = bmp;
        }
    }
}
